import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
export type BannerResult = {
  page: number;
  pagesize: number;
  success: boolean;
  code: number;
  token: string;
  msg: string;
  data: {
    img(img: any): string;
    data: any[];
    total: number;
    page: number;
    pagesize: number;
  };
};
// 抵押列表
export const collateralList = (data?: object) => {
  return http.request<BannerResult>(
    "get",
    baseUrlApi(
      `admin/collateral/list?page=${data.page}&pagesize=${data.pagesize}&collateral=${data.collateral}&company_name=${data.company_name}`
    ),
    {
      data
    }
  );
};
// 下拉框展示列表
export const collateralSelect = (data?: object) => {
  return http.request<BannerResult>(
    "get",
    baseUrlApi(`admin/collateral/select?collateral=${data.collateral}`),
    {
      data
    }
  );
};
export const companySelect = (data?: object) => {
  return http.request<BannerResult>(
    "get",
    baseUrlApi(`admin/company/select/name=&admin_id=${data.admin_id})`),
    {
      data
    }
  );
};
// 抵押添加
export const collateralInsert = (data?: object) => {
  return http.request<BannerResult>(
    "post",
    baseUrlApi("admin/collateral/insert"),
    {
      data
    }
  );
};
// 抵押修改
export const collateralUpdate = (data?: object) => {
  return http.request<BannerResult>(
    "post",
    baseUrlApi("admin/collateral/update"),
    {
      data
    }
  );
};

// 抵押删除
export const collateralDelete = (data?: object) => {
  return http.request<BannerResult>(
    "post",
    baseUrlApi("admin/collateral/delete"),
    {
      data
    }
  );
};
